import sys

from qtpy.QtCore import Qt
from qtpy.QtWidgets import QApplication, QWidget, QVBoxLayout

from qfluentwidgets_expand import PictureBrowserView


class PictureWidget(QWidget):
    def __init__(self):
        super().__init__()
        self.vertical_layout = QVBoxLayout(self)
        self.vertical_layout.setContentsMargins(0, 0, 0, 0)
        self.picture_browser = PictureBrowserView(self)
        self.picture_browser.setCloseVisible(False)
        # self.picture_browser.setPixmap('./resources/test.jpg')
        self.picture_browser.setUrl('http://p0.qhimg.com/bdm/512_316_0/t01b8d976a9f12bd368.jpg')
        self.vertical_layout.addWidget(self.picture_browser)


if __name__ == '__main__':
    QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    app = QApplication(sys.argv)
    demo = PictureWidget()
    demo.resize(800, 600)
    demo.show()
    sys.exit(app.exec_())
